<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <!-- No-op until loaded dynamically (could make configurable) -->
  <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" />
  <!-- STYLESHEETS (others loaded dynamically) -->
  <style id="styleoverrides" media="screen"></style>
  <link href="./svgedit.css" rel="stylesheet" media="all">
  </link>
  <!-- Lacking browser support -->
  <script type="module" src="./browser-not-supported.js"></script>
  <script type="module" src="./serveconfig.js"></script>
  <!-- <script type="module" src="./vue.js"></script>
  <script type="module" src="./index.js"></script>
  <link href="./index.css" rel="stylesheet" media="all"> -->
  <title>图元工具</title>
</head>
<!-- 测试修改 2 2 22222  4444 -->
<body style="margin:0">
  <div id="container" style="width:100%;height:100vh"></div>
</body>
 <!-- If you do not wish to add extensions by URL, you can add calls
      within the following file to svgEditor.setConfig -->
      <script type="module">
        function loadCssCode(code){
        var style = document.createElement('style');
        style.type = 'text/css';
        style.rel = 'stylesheet';
        style.id = 'svgeditorcss'
        //for Chrome Firefox Opera Safari
        style.appendChild(document.createTextNode(code));
        //for IE
        //style.styleSheet.cssText = code;
        var head = document.getElementsByTagName('head')[0];
        head.appendChild(style);
}
        window.urlType = 'ElementEditing';
        import Editor from './Editor.js'
/* for available options see the file `docs/tutorials/ConfigOptions.md */
var width = Math.round((window.innerWidth-310-218-15)/20)*20
var height =  Math.round((window.innerHeight-150-15)/20)*20
var right_panel_width = window.innerWidth-310-15- width
var bottom_panel_height = window.innerHeight-15- height
var cssStr = `.svg_editor{grid-template-rows: auto 15px 1fr ${bottom_panel_height}px;grid-template-columns: 310px 15px 50px 1fr ${right_panel_width}px;}`
loadCssCode(cssStr)
const svgEditor = new Editor(document.getElementById('container'))

svgEditor.init()

svgEditor.setConfig({
          serviceUrl:serviceUrl,//正式部署直接用window.parent.serverurl
          canvas_expansion: 1,
          dimensions: [width,height],
          allowInitialUserOverride: true,
          extensions: ['ext-overview_window','ext-server-opensave','ext-cube','ext-arc'],
          noDefaultExtensions: false,
          // userExtensions: [ { pathName: './react-extensions/react-test/dist/react-test.js' }]
        },{allowInitialUserOverride:true})
        console.log(svgEditor.configObj.curConfig.serviceUrl)
// Variable XDOMAIN below is created by Rollup for the Xdomain build (see rollup.config.js)
/* globals XDOMAIN */
try { // try clause to avoid js to complain if XDOMAIN undefined
          if (XDOMAIN) {
            svgEditor.setConfig({
              canvasName: 'xdomain', // Namespace this
              allowedOrigins: [ '*' ]
            })
    console.info('xdomain config activated')
  }
        } catch (error) { /* empty fn */ }
      
       
     
          
      </script>
</html>
